#include<stdio.h>

struct TreeNode
{
	struct TreeNode* left;
	struct TreeNode* right;
	int val;
};

//int maxDepth(struct TreeNode* root)
//{
//	if (root==NULL)
//	{
//		return 0;
//	}
//	return maxDepth(root->left) > maxDepth(root->right) ? maxDepth(root->left) + 1 : maxDepth(root->right) + 1;
//}

int maxDepth(struct TreeNode* root)
{
	if (root == NULL)
	{
		return 0;
	}
	int leftdeep = maxDepth(root->left);
	int rightdeep = maxDepth(root->right);
	return leftdeep > rightdeep ? leftdeep + 1 : rightdeep + 1;
}